<?php
/**
 * Headers.php
 * 
 * @category   Naneau
 * @package    Naneau_Plugin
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl
 * @version    0.1
 */

/** base class */
require_once 'Zend/Controller/Plugin/Abstract.php';

/**
 * Naneau_Controller_Plugin_Headers
 * 
 * a little experiment =]
 *
 * @category   Naneau
 * @package    Naneau_Plugin
 * @copyright  Copyright (c) 2007 Maurice Fonk - http://naneau.nl
 */
class Naneau_Controller_Plugin_Headers extends Zend_Controller_Plugin_Abstract {

    /**
     * dispatch shutdown hook
     */
    public function dispatchLoopShutdown() {
        $viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('viewRenderer');
        //view renderer action helper
        if (!$viewRenderer->getNeverRender()) {
            $charset = $viewRenderer->view->getEncoding();
            //default charset
            
            $mime = $viewRenderer->view->mimeType();
            //the mimetype
            
            $this->getResponse()->setRawHeader("Content-Type: $mime; charset=$charset");
            //set the proper header
        }
    }
}